<?php
namespace app\admin\controller;

use think\Controller;
use think\Db;

class Index extends Controller
{
    /**
     * 后台布局
     * @return \think\response\View
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function layout()
    {
        $user = session('user');
        if(1){
            $nodes = Db::name('SystemAuthNode')->whereIn('auth', $user['authorize'])->column('node');
            $res =  Db::name('SystemMenu')->whereIn('route', $nodes)->where('status', 1)->select();
            $data = formatData($res);
            session('menu', $data);
        } else {
            $data = session('menu');
        }

        return view('',['data'=>$data, 'user' => $user]);
    }

    public function index() {
        return view();
    }
}
